const globalIp = getApp().globalData.userIp
Page({

  /**
   * 页面的初始数据
   */
  data: {
    OneMonthNum: '0',
    ThreeMonthNum: '0',
    HalfYearNum: '0',
    FullYearNum: '0',
    WoFullYearNum: '0',
    AllNum: '0'
  },

  gridBtn(e) {
    console.log(e.currentTarget.dataset.num)
    wx.navigateTo({
      url: './increaseIndex/increaseIndex?Levels='+e.currentTarget.dataset.num,
    })
  },

  getManage: function() {
    let that = this;
    wx.showLoading({
      title: '加载中',
      mask: true
    })
    wx.request({
      url: globalIp + 'home/ocrd/getCardIncrease',
      data: {
        openId: wx.getStorageSync('userInfo').openid,
        pageIndex: 0,
        value: 1
      },
      header: {
        'content-type': 'application/json'
      },
      method: 'POST',
      success: function(res) {
        if (res.data.jsonObject) {
          var data = res.data.jsonObject.data;
          that.setData({
            OneMonthNum: data[0].OneMonthNum,
            ThreeMonthNum: data[0].ThreeMonthNum,
            HalfYearNum: data[0].HalfYearNum,
            FullYearNum: data[0].FullYearNum,
            WoFullYearNum: data[0].WoFullYearNum,
            AllNum: data[0].AllNum
          })
        }
      },
      fail: function(res) {
        wx.showToast({
          title: '请返回上一页面，重新请求',
          icon: 'none',
          duration: 2000,
        })
      },
      complete: function(res) {
        wx.hideLoading()
      }
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    this.getManage()
  },
})